The present invention discloses a progressive decoding method and an apparatus thereof. In particular, the present invention discloses a method and a related apparatus capable of decoding each scan so as to generate a partial decoded pixel and a corresponding non-zero indicator, and summing up the partial decoded pixels generated each time and updating a non-zero history with the non-zero indicator, thereby reducing the demand of memory capacity.
The Joint Photographic Expert Group (JPEG) standard can efficiently compress digital gray scale or color images, and four different operation modes are included in the specification, which use different encoding and decoding algorithm respectively: Sequential Discrete Cosine Transform (DCT) based, Progressive DCT based, Lossless, and Hierarchy mode. The JPEG format is frequently used in the Internet to compress still image. Since the image data encoded in the JPEG format are of a certain size, the image can not be completely displayed until all the data are completely received in the Internet environment. When the available bandwidth is limited, it may take much time to display the whole image, and results in Internet resource waste. Thus, among the four different operation modes of JPEG, the progressive DCT based technology becomes the most popular jPEG decoding technology because it can display a rough image first and refine the image over time. Therefore, users can view the image being received roughly before the whole image is completely received.
For the progressive DCT based encoding procedure, a sample block consists of 8×8 samples. When an image is being encoded, the sample blocks are typically input from the left to the right, and block-row by block-row from the top to the bottom. Please refer to FIG. 1. FIG. 1 is a diagram of a related art progressive JPEG encoder 10, and it illustrates a related art progressive JPEG encoding procedure. The JPEG encoder 10 shown in FIG. 1 comprises a forward DCT transformer 12, a quantizer 14, a first memory buffer 16, and a variable length encoder 18. After a sample block is transformed into 64 digital DCT coefficients by a forward DCT transformation operation by the forward DCT transformer 12, and then quantized by the quantizer 14, and prepared for entropy encoding, all 64 of its quantized DCT coefficients can be immediately entropy encoded by the variable length encoder 18, and output as part of the compressed JPEG bit-stream signal. In the progressive DCT based encode procedure; the whole image is encoded by multiple scanning the image, and the compressed JPEG bit-stream signal comprises a plurality of scans. To accomplish multiple scanning, the first memory buffer 16 with storage volume approximating to the size of a single image is intervened between the quantizer 14 and the variable length encoder 18. As each sample block is transformed by the forward DCT transformer 12 and then quantized by the quantizer 14, its DCT quantized coefficients are stored in the first memory buffer 16. When all the sample blocks have finished the DCT transformation and are quantized, the quantized DCT coefficients in the first memory buffer 16 are scanned for multiple times, and the variable length encoder 18 encodes the partial quantized DCT coefficients in each of the multiple scans. Therefore, the data in a scan are formed. As mentioned above, the advantages of the progressive DCT based technology are that the scans in JPEG bit-stream signal received first are decoded first and a rough image could be displayed. The more scans received, the finer the image is. The JPEG bit-stream signal begins to be decoded even before the whole bit-stream signal is completely received.
There are two methods of multiple scanning: the spectral selection and the successive approximation. The spectral selection involves transmitting the data of part of the frequency bands in each sample block. Since most of the data of general images lie in lower frequency bands, the data of lower frequency bands can be firstly transmitted followed by the data of higher frequency bands. The successive approximation involves transmitting the most significant bit (MSB) first followed by the least significant bit while transmitting some part of bits of the digital DCT coefficients. Please refer to FIG. 2. FIG. 2 is a diagram illustrating a related art spectral selection method. In the (progressive DCT based) JPEG standard, an image can be separated into a plurality of sample blocks, each of which is the size of 8×8. In FIG. 2, the cube 20 on the top is the set of the whole sample blocks of an image. The smaller cubes (sub-cubes) lining up from the right to the left (sub-cube 0 to 7) represent a quantized DCT coefficient, where each sub-cube represents one bit. That is to say, sub-cubes 0 to 7 distinctly correspond to bits 0 to 7 wherein the left most bit is the MSB and the right most bit is the LSB. The 64 quantized DCT coefficients in a vertical plane are the coefficients of one sample block and each horizontal line is defined as the zeroth to the 63rd quantized DCT coefficients from top to bottom. The total number of bits is 64×8. In FIG. 2, the zeroth quantized DCT coefficient is transmitted and defined as scan(0) when it is scanned the first time; the first and the second quantized DCT coefficients are transmitted and defined as scan(1) when it is scanned the second time; and the third, fourth and fifth quantized DCT coefficients are transmitted and defined as scan(2) when it is scanned the third time. The whole image data are transmitted as the rule described above. Since each quantized DCT coefficient in the sample block corresponds to different frequencies, different quantized DCT coefficients in the sample block are transmitted in each of multiple scans to accomplish spectral selection.
Please refer to FIG. 3. FIG. 3 is a diagram illustrating a related art successive approximation procedure. The cube 30 is the set of the whole sample block of the image. The zeroth quantized DCT coefficient of each sample block is transmitted and defined as scan (0) when it is scanned the first time; the bits 7 to 4 of the quantized DCT coefficients of the sample block are transmitted and defined as scan (1) when it is scanned the second time; and the bit 3 of the quantized DCT coefficients of the sample block are transmitted and defined as scan (2). Transmitting different bits when scanning at different times can accomplish the successive approximation. All the rules described above can be adjusted to achieve different progressive image effects.
The decoding process is the inverse process of encoding. Please refer to FIG. 4. FIG. 4 is a block diagram of part of the components in a progressive JPEG decoder 40, and it also illustrates a related art progressive JPEG decoding procedure. FIG. 4 shows a variable length encoder 42(VLD), an inverse quantizer 44, a second memory buffer 46, and an inverse DCT transformer 48. Generally speaking, the encoded JPEG bit-stream signal (transmitted from the JPEG encoder 10 in FIG. 1) is decoded by the variable length decoder 42. In the related art progressive JPEG decoder 40, there is a second memory buffer 46 with storage volume approximating to the size of the image where the quantized DCT coefficients can be stored after the process of the variable length decoder 42. When all the quantized DCT coefficients (after the process of the variable length decoder 42) in one scan of the JPEG bit-stream signal are collected, the progressive image is rebuilt with the decoded pixels generated after the inverse quantized operation of the inverse quantizer 44 and the inverse DCT (IDCT) operation of the inverse DCT transformer 48. However the size of the images may be very large, for example, in the JPEG CCITT T.81 specification the image size could be as large as 65535×65535 pixels. Since the related art progressive JPEG decoder 40 could not incorporate a second memory buffer 46 with giga-byte size capacity, the images may not be able to be decoded successfully. Furthermore, the information application (IA) products are very popular now and equipped with much smaller memory size than traditional desktop personal computer. Hence, it becomes more and more important to develop a new progressive JPEG decoding algorithm and the apparatus thereof to reduce the capacity requirement of the second memory buffer 46 in FIG. 4.